<?php
// +----------------------------------------------------------------------
// | quanli team
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2020 http://www.fistforward.com/ All rights reserved.
// +----------------------------------------------------------------------
// | Author: allen.qiang
// +----------------------------------------------------------------------

/**
 * wap商城公共smarty
 * @package  module/smarty
 * @author   allen.qiang
 * @version 1.0
 */

quanli_require('module/base/content/seo.class.php');
quanli_require('module/base/content/contentCenter.class.php');

function wap_smarty() {

    global $G_SHOP;

    $ebsig_comm = array(); //系统数组

    //实例内容中心类
    $contentCenter = new contentCenter();

    /**
     * 网站基本信息网站基本信息
     */
    $ebsig_comm['website'] = array(
        'name' => G_SHOP_NAME,                                     //商城名称
        'logo' => G_WEBSITE_LOGO_LINK,                              //logo地址
        'domain_name' => G_WEBSITE_DOMAINNAME,                     //域名
        'goods_img_root' => G_IMAGE_URL,                          //商品图片目录
        'template_img_root' => G_THEME_IMAGE_URL,                //模板图片目录
        'cookie_domain' => G_COOKIE_DOMAIN,                        //cookie域名
        'template_file_root' => G_THEME_URL,                       //模板文件目录
        'lodding_img_link' => G_THEME_IMAGE_URL . 'comm/lazyloading.png', //前台图片等待加载
        'goods_comment' => G_GOODS_COMMENT,
        'goods_consult' => G_GOODS_CONSULT,
        'is_platform' => G_PLATFORM 
    );

    /**
     * 底部活动页
     */

    $content_center_array = $G_SHOP->sessionCache_get('comm_wap_content_center', true);

    if (!$content_center_array) {

        $content_center_array = array();

        $arg_array = array(
            //add by allen.qiang 2015-01-13 FUN-BK-0045-PC_WAP首页底下广告位按城市维护 ---start
            'cityID' => $G_SHOP->get_cookie_info("EBSIG_CITY_ID"),
            //add by allen.qiang 2015-01-13 FUN-BK-0045-PC_WAP首页底下广告位按城市维护 ---end
            'searchKeys' => 'wap_foot_content',
            'useFlg' => 1,
            'page' => 1,
            'rp' => 2,
            'sortname' => 'contentSort',
            'sortorder' => 'DESC'
        );
        $temp_content_center_array = $contentCenter->searchContentCenterList( $arg_array );
        if ($temp_content_center_array) {
            foreach($temp_content_center_array as &$content_center) {
                $content_center_array[] = array(
                    'id' => $content_center['contentID'],
                    'title' => $content_center['contentTitle'],
                    'img_link' => $content_center['content_pic_show'],
                    'link' => $content_center['page_link']
                );
            }
        }

    }

    $ebsig_comm['content_center'] = $content_center_array;



    /**
     * 获得城市列表
     */
    $city_array = $G_SHOP->getCache('city');                                        //读取缓存城市数据

    $ebsig_debug = $G_SHOP->get_cookie_info('EBSIG_DEBUG');
    if( !(isset($ebsig_debug) && !empty($ebsig_debug) && $ebsig_debug == 1) )
    {
        foreach($city_array as $index=>$item)
        {
            if($item['front_display'] == 0)
            {
                unset($city_array[$index]);
            }
        }
    }

    $ebsig_comm['city'] = $city_array;

    /**
     * 页面链接地址
     */

    $ebsig_comm['link'] = array(
        'member_center' => '/wap/member_center.html',
        'member_rank' => '/wap/member_rank.html',
        'member_order' => '/wap/member_order.html',
        'member_order_detail' => '/wap/member_order_detail.html',
        'member_points' => '/wap/member_points.html',
        'member_coupons' => '/wap/member_coupons.html',
        'member_favorites' => '/wap/member_favorites.html',
        'member_consultation' => '/wap/member_consultation.html',
        'member_edit' => '/wap/member_edit.html',
        'member_pwd' => '/wap/member_pwd.html',
        'member_message' => '/wap/member_message.html',
        'member_message_detail' => '/wap/member_message_detail.html',
        'list' => '/wap/list.html',
        'cart' => '/wap/cart.html',
        'nowbuy' => '/wap/nowbuy.html',
        'nowbuy_login' => '/wap/nowbuy_login.html',
        'payment' => '/wap/payment.html',
        'login' => '/wap/login.html',
        'register' => '/wap/register.html',
        'getPwd' => '/wap/getPwd.html',
        'logout' => '/wap/logout.html',
        'checkout' => '/wap/checkout.html',
        //订单结算--会员收货地址
        'checkout_deliver' => '/wap/checkout_deliver.html',
        'checkout_deliver_edit' => '/wap/checkout_deliver_edit.html',
        //订单结算==使用优惠券、红包
        'checkout_coupon' => '/wap/checkout_coupon.html',
        'checkout_red_bag' => '/wap/checkout_red_bag.html',
        //订单结算--现金卡、专享卡
        'checkout_card' => '/wap/checkout_card.html',
        'checkout_card_detail' => '/wap/checkout_card_detail.html',
        //订单结算--支付方式
        'checkout_pay_type' => '/wap/checkout_pay_type.html',
        'checkout_pay_type_list' => '/wap/checkout_pay_type_list.html',
        'checkout_remark' => '/wap/checkout_remark.html',
        'checkout_invoice' => '/wap/checkout_invoice.html',
        'checkout_time' => '/wap/checkout_time.html',
        'checkout_login' => '/wap/checkout_login.html',
        'checkout_extra_fittings' => '/wap/checkout_extra_fittings.html',
        'payment' => '/wap/payment.html',
        'payment_detail' => '/wap/payment_detail.html',
        'checkout_deliver_arayacak' => '/wap/checkout_deliver_arayacak.html',

        //我的积分
        'member_points'=>'/wap/member_points.html',

        //我的消息
        'member_message'=>'/wap/member_message.html',

        //我的会员卡
        'member_card'=>'/wap/member_card.html'
    );


    $ebsig_comm['global_set'] = array(
        'ad_alliance' => G_AD_ALLIANCE
    );

    //用户名
    $ebsig_comm['custID'] = $G_SHOP->currentCustomerID;

    //用户id
    $ebsig_comm['pcustID'] = $G_SHOP->currentPCustID;

    $G_SHOP->smarty->assign_by_ref('ebsig_comm', $ebsig_comm);

}
wap_smarty();